import  pymysql
# """连接数据库"""
conn = pymysql.connect(host="127.0.0.1",
                       port=3306,
                       user="root",
                       password="root",
                       database="books",
                       charset="utf8",
                       autocommit=True)
# """创建游标"""
cursor = conn.cursor()
# """创建sql语句"""
sql = "delete from t_book where title='西游记'"
# 使用sql语句
cursor.execute(sql)
print(cursor.rowcount)